# -*- Makefile -*-
include $(RTMEUSDIR)/src/Makefile.generic

TARGET=StateService

SKEL_OBJ = $(TARGET)Skel.o  	
STUB_OBJ = $(TARGET)Stub.o
IMPL_OBJ = StateManagerService.o
OBJFILES = $(SKEL_OBJ) $(IMPL_OBJ) StateManager.o State.o
OBJS     = $(addprefix $(OBJDIR)/, $(OBJFILES))
TARGETLIB = $(LIBDIR)/lib$(TARGET).$(LSFX)

all:  $(TARGETLIB)

$(TARGETLIB): $(OBJS)
	$(CXX) $(SHFLAGS) -o $@ $(OBJS) $(LDFLAGS)

clean: clean_objs clean_skelstub clean_cchh
	rm -f $(TARGETLIB) *.o *~

clean_objs:
	rm -f $(OBJS)

clean_skelstub:
	rm -f *Skel.h *Skel.cpp
	rm -f *Stub.h *Stub.cpp

clean_cchh:
	rm -f *.hh *.cc

$(TARGET)Skel.cpp : $(TARGET).idl
	$(IDLC) $(IDLFLAGS) $<
	$(WRAPPER) $(WRAPPER_FLAGS) --idl-file=$<
$(TARGET)Skel.h : $(TARGET).idl
	$(IDLC) $(IDLFLAGS) $<
	$(WRAPPER) $(WRAPPER_FLAGS) --idl-file=$<
$(TARGET)Stub.cpp : $(TARGET).idl
	$(IDLC) $(IDLFLAGS) $<
	$(WRAPPER) $(WRAPPER_FLAGS) --idl-file=$<
$(TARGET)Stub.h : $(TARGET).idl
	$(IDLC) $(IDLFLAGS) $<
	$(WRAPPER) $(WRAPPER_FLAGS) --idl-file=$<

$(OBJDIR)/StateManagerService.o: StateManagerService.cpp StateManagerService.h StateManager.h State.h StateService.idl
	$(CXX) $(CXXFLAGS) -c -o $@ $<
$(OBJDIR)/StateManager.o: StateManager.cpp StateManager.h State.h StateService.idl
	$(CXX) $(CXXFLAGS) -c -o $@ $<
$(OBJDIR)/State.o: State.cpp State.h StateManagerService.h
	$(CXX) $(CXXFLAGS) -c -o $@ $<

$(OBJDIR)/$(TARGET)Skel.o: $(TARGET)Skel.cpp $(TARGET)Skel.h $(TARGET)Stub.h
	$(CXX) $(CXXFLAGS) -c -o $@ $<

$(OBJDIR)/$(TARGET)Stub.o: $(TARGET)Stub.cpp $(TARGET)Stub.h
	$(CXX) $(CXXFLAGS) -c -o $@ $<

# end of Makefile
